<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.List"%>
<%@ page import="activity.Activity"%>
<%@ page import="activity.Shop"%>
<%@ page import="javax.jdo.PersistenceManager" %>
<%@ page import="javax.jdo.Query" %>
<%@ page import="activity.PMF" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>提供點數上架</title>
<style type="text/css">
<!--
body {
	background-color: #99C;
	text-align: center;
}

a {text-decoration: none;
	 color: #000;
} 


.tbl {
	color: #633;
	font-size: 25px;
	text-align: center;
}
.tblUp {
	color: #000;
	text-decoration: none;
}
-->
</style></head>

<body>
<form id="form1" name="form1" method="post" action=/activity/addSupply>
<table width="500" height="369" border="1" align="center">
<%
PersistenceManager pm = PMF.get().getPersistenceManager();
Query query = pm.newQuery(Activity.class);

//query.setFilter("inventory >= reorderPoint"); //DOES NOT WORK
//query.setOrdering("hireDate desc");
//query.declareParameters("String lastNameParam");

try {
	
	
    List<Activity> results = (List<Activity>) query.execute();
    
%>
 

  <tr>
    <td width="289" class="tbl">&nbsp;</td>
    <td width="407" class="tbl">點數上架</td>
  </tr>
    <td height="40" class="tbl">提供廠商:</td>
	<td>
  <select name="actShop_s">
  <%if (!results.isEmpty()) {            
            for (Activity act : results) {%>
    <option><%=act.getActShop() %></option>
<% 
     }
            }

%>
    
  </select>
  </td>

  <tr>
    <td class="tbl">提供活動名稱:</td>
    <td>
      <label>
        <select name="actName_s">
<%if (!results.isEmpty()) {            
            for (Activity act : results) {%>
    <option><%=act.getActName() %></option>
<% 
     }
            }

%>
            </select>
      </label>
    </td>
  </tr>
  <tr>
    <td class="tbl">提供數量:</td>
    <td>
      <label>
        <input type="text" name="actPoint_s" size="2" />
      </label>
    </td>
  </tr>
  <tr>
    <td class="tbl">提供截止日</td>
    <td><input type="text" name="actEnd_s" id="textfield2" /></td>
  </tr>

  <tr>
    <td class="tbl">提供描述</td>
    <td><textarea name="actContent_s"> </textarea></td>
  </tr>
  <tr>
  
    <td class="tbl">需求商家名稱:</td>
    <td>
      <label>
        <select name="actShop_d">
          <%if (!results.isEmpty()) {            
            for (Activity act : results) {%>
    <option><%=act.getActShop() %></option>
<% 
     }
            }

%>
    
        </select>
      </label>
    </td>
  </tr>
  <tr>
    <td class="tbl">需求活動名稱:</td>
    <td>
      <label>
        <select name="actName_d">
          <%if (!results.isEmpty()) {            
            for (Activity act : results) {%>
    <option><%=act.getActName() %></option>
<% 
     }
            }

%>
    
        </select>
      </label>
    </td>
  </tr>
  <tr>
    <td class="tbl">需求點數數量:</td>
    <td>
      <label>
        <input type="text" name="actPoint_d" size="2"/>
      </label>
    </td>
  </tr>
    
</table>
<%    
}//try
finally {
    query.closeAll();
}

%> 
<input type="submit" value="我要上傳"/>
</form>

　

</body>
</html>
